package org.tong.activiti6.listeners;

import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class ActivitiConfg implements ProcessEngineConfigurationConfigurer {

    @Autowired
    private MyActivitiEventListener myActivitListener;

    @Override
    public void configure(SpringProcessEngineConfiguration springProcessEngineConfiguration) {
        List<ActivitiEventListener> eventListeners = new ArrayList<>();
        eventListeners.add(myActivitListener);
        springProcessEngineConfiguration.setEventListeners(eventListeners);
    }
}
